﻿using NAudio.Wave;

namespace SpeedRecognition.RecordModel
{
    internal class RecordFileStream(WaveFormat waveFormat, string outFilePath): IRecordStream
    {
        public string OutFilePath { get;private set; } = outFilePath;

        public WaveFileWriter WaveFileWriter { get; } = new(outFilePath, waveFormat);

        public void Write(WaveInEventArgs waveInEventArgs)
        {
            WaveFileWriter.Write(waveInEventArgs.Buffer, 0, waveInEventArgs.BytesRecorded);
        }
        public void Dispose()
        {
            WaveFileWriter.Dispose();
        }
    }
}
